#ifndef LOGINWINDOW_H
#define LOGINWINDOW_H

#include <QDialog>
#include "mytcpsocket.h"
#include "registerwindow.h"
#include "forgetpwdwindow.h"
#include "gifthread.h"

namespace Ui {
class LoginWindow;
}

class LoginWindow : public QDialog
{
    Q_OBJECT

public:
    explicit LoginWindow(QDialog *parent = nullptr);
    ~LoginWindow();
    // 初始化控件
    void initControl();
    // 初始化信号槽
    void initSignalSlot();
    // 重载show()
    void myShow(int id);

    RegisterWindow *getRegister_window() const;

    GifThread *getT1() const;

protected:
    //重写窗口关闭事件
    void closeEvent(QCloseEvent *event)override;
    // 重写事件过滤器
    bool eventFilter(QObject *object, QEvent *event)override;
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
signals:
    // 登录成功信号
    void login_success();

private slots:
    void on_btn_login_clicked();

    void on_btn_close_clicked();

    void on_le_user_editingFinished();

    void on_btn_min_clicked();

private:
    Ui::LoginWindow *ui;
    bool isDragging;        // 是否在用鼠标拖动
    QPoint dragPosition;    // 鼠标坐标

    RegisterWindow* register_window;    // 注册窗口
    ForgetPwdWindow* forgetpwd_window;   // 忘记密码窗口
    GifThread* t1;
};

#endif // LOGINWINDOW_H
